package cn.geckos.flexforum.ui
{
import flash.events.Event;
	
import mx.containers.Form;
import mx.core.UIComponent;

import cn.geckos.flexforum.events.FormEvent;

/**
 * 表单的主体提交事件
 */ 
[Event(name="submit", type="cn.geckos.flexforum.events.FormEvent")]

[Event(name="cancel", type="cn.geckos.flexforum.events.FormEvent")]


/**
 * 表单基类
 * @author harry
 */
public class BasicForm extends Form
{
	
	/**
	 * 提交表单时广播事件
	 */
	protected function performSubmit(e:Event=null):void
	{
		dispatchEvent(new FormEvent(FormEvent.SUBMIT));
	}
	
	/**
	 * 退出/关闭表单时广播事件
	 */ 
	protected function performCancel(e:Event=null):void
	{
		dispatchEvent(new FormEvent(FormEvent.CANCEL));
	}
	
	/**
	 * 显示或隐藏某一部分组件
	 */ 
	protected function showUI(comp:UIComponent, isShow:Boolean):void
	{
		if(isShow)
			comp.height = comp.percentHeight;
		else
			comp.height = 0;
		comp.visible = isShow;
	}
}
}